<template>
  <div class="allbox">
    <van-nav-bar
      fixed
      placeholder
      safe-area-inset-top
      title="通知列表"
      left-arrow
      right-text="清除未读"
      @click-left="back"
      @click-right="clear"
    />
    <div class="content">
      <div v-for="item in noticelist" :key="item" @click="jump">
        <div class="time">{{ item.time }}</div>
        <div class="showus">
          <div class="fbox">
            <span
              class="lpart"
            ><van-icon size="14" color="#FFB826" name="comment-circle" />{{
              item.type
            }}</span>
            <span
              class="rpart"
            ><span ref="tipnumber" class="tipnumber">1</span><span>查看详情 ></span></span>
          </div>
          <div>{{ item.title }}</div>
          <div>{{ item.content }}</div>
        </div>
      </div>
      <div v-show="noticelist.length == 0" class="nonotice">暂无通知消息</div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      noticelist: []
    }
  },
  methods: {
    back() {
      this.$router.go(-1)
    },
    clear() {
      this.$refs.tipnumber.style = 'display:none'
    },
    jump() {
      this.$router.push({ path: '/infocontent' })
    }
  }
}
</script>

<style lang="less" scoped>
.allbox {
  height: 100%;
  .content {
    height: 100%;
    background-color: #f1f1f1;
    padding: 0 15px;
    box-sizing: border-box;
    .time {
      text-align: center;
      font-size: 12px;
      padding: 5px 0;
      color: #333;
    }
    .showus {
      border-radius: 10px;
      background-color: #fff;
      padding: 10px 5px;
      .fbox {
        border-bottom: 1px solid #ccc;
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding-bottom: 5px;
        .lpart {
          font-size: 12px;
          color: #999;
          line-height: 25px;
          .van-icon {
            margin-right: 5px;
          }
        }
        .rpart {
          span {
            &:last-child {
              font-size: 13px;
              color: #999;
            }
          }
          .tipnumber {
            display: inline-block;
            text-align: center;
            line-height: 18px;
            border-radius: 50%;
            width: 18px;
            height: 18px;
            background-color: #d43b33;
            color: #fff;
            font-size: 14px;
          }
        }
      }
      div {
        &:nth-child(2) {
          font-weight: bold;
          margin: 10px 0 5px;
          padding-left: 5px;
        }
        &:last-child {
          font-size: 12px;
          padding-left: 5px;
        }
      }
    }
  }
}
.nonotice {
  text-align: center;
  color: #333;
  font-size: 14px;
  padding-top: 20px;
}
</style>
